<?php
	require "settings/config.php";
	require "layout.php";
	require "includes/session.php";
	require "includes/sql_functions.php";
	require "includes/slot_functions.php";
	require "includes/game_functions.php";
	require "includes/scen_functions.php";
	require "includes/misc_functions.php";
	require "includes/signup_functions.php";
	
	if(!oh_is_logged_in())
	{
		header('Location: login.php');
		die();
	}
	
	$result=check_can_signup_as_GM($_SESSION['user_id']);
	
	if($result=="CLEAR")
	{	
		if($_GET['game'])
		{
			$result=signup_gm_for_game($_GET['game'],$_SESSION['user_id']);
		
			if($result=="CONFLICT")
				header ('Location: gameinfo.php?game='.$_GET['game'].'&conflict=1');
			else
				header ('Location: gameinfo.php?game='.$_GET['game'].'&gmsignup=1');
		}
	} 
	else if ($result=="NOT_CLEAR") 
	{
		header ('Location: gameinfo.php?game='.$_GET['game'].'&notclear=1');
	}
	
?>
